<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>rest webservice for calendars</title>
</head>
<body>
<%
    // This scriptlet declares and initializes "date"
    System.out.println("Evaluating date now");
    java.util.Date now = new java.util.Date();
    
%>
The time is now:   
<%
    out.println( now );
//     out.println( "<BR>Your machine's address is " );
//     out.println( request.getRemoteHost());
%>

	<br>
<form name="eventform" action="../CalModule/rest/events" method="post">
Action: <select name=action>
  <option value="add">Add Event</option>
  </select>
  <br>
Month: <select name = month >
<%
	for(int i = 1; i <= 12; ++i) {
		out.print("<option value=\"" + i + "\"");
		if(i == (now.getMonth() + 1))
			out.print(" selected ");
		out.println(">" + i +"</option>");
	}
%>

</select> 
Day: <select name = day>
<%
	for(int i = 1; i <= 31; ++i) {
		out.print("<option value=\"" + i + "\"");
		if(i == (now.getDate()))
			out.print(" selected ");
		out.println(">" + i +"</option>");
	}
%>
</select> 
Year: <select name = year>
<%
	for(int i = 2011; i <= 2015; ++i) {
		out.print("<option value=\"" + i + "\"");
		out.println(">" + i +"</option>");
	}
%>
</select> <br>
Time: <select name = hour>
<%
	for(int i = 0; i <= 23; ++i) {
		out.print("<option value=\"" + i + "\"");
		if(i == (now.getHours()))
			out.print(" selected ");
		out.println(">" + i +"</option>");
	}
%>
</select> 
:
<select name = minute>
	<%
	for(int i = 0; i <= 59; ++i) {
		out.print("<option value=\"" + i + "\"");
		if(i == (now.getMinutes()))
			out.print(" selected ");
		out.println(">" + i +"</option>");
	}
%>
</select>

<br>
Event duration: 
Hours: 
<select name = durationHours>
	<option value="0" selected>0</option>
	<option value="1">1</option>
	<option value="2">2</option>
	<option value="3">3</option>
	<option value="4">4</option>
	<option value="5">5</option>
	<option value="6">6</option>
	<option value="7">7</option>
	<option value="8">8</option>
	<option value="9">9</option>
	<option value="10">10</option>
</select>
Minutes:
<select name = durationMinutes>
	<option value="5">5</option>
	<option value="10">10</option>
	<option value="15" selected>15</option>
	<option value="20">20</option>
	<option value="25">25</option>
	<option value="30">30</option>
	<option value="35">35</option>
	<option value="40">40</option>
	<option value="45">45</option>
	<option value="50">50</option>
	<option value="55">55</option>
</select>

<br>
Event Title: <input type="text" name=title value="Enter a title." onclick="document.eventform.title.value='';" />

<br>
Event Content: <br> <textarea name=content rows="10" cols="30" onclick="document.eventform.content.value='';">
Enter event details here
</textarea>

<br>
<input type="submit" value="Submit" />
<br>

</form>

<br>
<iframe id='fra' src="https://www.google.com/calendar/embed?mode=WEEK&amp;height=600&amp;wkst=2&amp;hl=en&amp;bgcolor=%23FFFFFF&amp;src=mikew%40h5sw.com&amp;color=%23182C57&amp;ctz=America%2FLos_Angeles" style=" border-width:0 " width="100%" height="600" frameborder="0" scrolling="no"></iframe>

</body>
</html>
